package com.cold.demo.template.config;

import com.alibaba.fastjson.JSONObject;
import com.cold.demo.template.mapper.CommonMapper;
import lombok.extern.slf4j.Slf4j;
import lombok.extern.slf4j.XSlf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Slf4j
@Order(1)
@Component
public class AppRunner implements ApplicationRunner, CommandLineRunner {

    @Autowired
    CommonMapper commonMapper;
    @Autowired
    JdbcTemplate jdbcTemplate;

    @Override//
    public void run(ApplicationArguments args) throws Exception {
//        List<Map<String, Object>> maps = jdbcTemplate.queryForList("select * from wxid_g7ri3vmqxpt022Info");
//        System.out.println(maps);
        /*Map<String, Object> request_log = commonMapper.queryTable("request\\_log");
        if (request_log == null || request_log.values().size() == 0) {
            try {
                commonMapper.createRequestLogTable();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }*/
    }

    @Override
    public void run(String... args) throws Exception {

    }
}
